#pragma once

#include <shlobj.h>
#include <gdiplus.h>

struct DesktopSortConfig
{
	// Background
	Gdiplus::Color bgGradientColor1;
	Gdiplus::Color bgGradientColor2;
	bool useExistingWallaper;

	wchar_t originalWallpaperPath[MAX_PATH];

	// Group
	Gdiplus::Color itemGradientColor1;
	Gdiplus::Color itemGradientColor2;

	Gdiplus::Color borderColor;

	// Opacity
	unsigned char groupOpacity;
	unsigned char groupBorderOpacity;

	// Font
	LOGFONTW groupNamefont;
	Gdiplus::Color fontColor;

	DesktopSortConfig():
	bgGradientColor1(Gdiplus::Color::Green),
		bgGradientColor2(Gdiplus::Color::Blue),
		itemGradientColor1(Gdiplus::Color::LightYellow),
		itemGradientColor2(Gdiplus::Color::Red),
		useExistingWallaper(false),
		fontColor(Gdiplus::Color::White),
		borderColor(Gdiplus::Color::White),		
		groupOpacity(255),
		groupBorderOpacity(255)
	{
		ZeroMemory(originalWallpaperPath, sizeof(originalWallpaperPath));
		ZeroMemory(&groupNamefont, sizeof(groupNamefont));

		groupNamefont.lfHeight = -24;
		groupNamefont.lfWeight = 700;
		groupNamefont.lfCharSet = 177;
		groupNamefont.lfOutPrecision = 1;
		groupNamefont.lfClipPrecision = 2;
		groupNamefont.lfQuality = 1;
		groupNamefont.lfPitchAndFamily = 34;
		wcscpy_s(groupNamefont.lfFaceName, LF_FACESIZE, L"Times new Roman");
	}


	bool SaveToRegistry()
	{	
		CRegKey key;
		long nError = key.Create(HKEY_CURRENT_USER, L"Software\\FilerFrog");

		if (nError == ERROR_SUCCESS)
		{
			if (key.SetBinaryValue(L"LastDesktopSortData", this, sizeof(DesktopSortConfig)) == ERROR_SUCCESS)
			{
				return true;
			}
		}

		return false;
	}

	bool LoadFromRegistry()
	{
		CRegKey key;
		long nError = key.Open(HKEY_CURRENT_USER, L"Software\\FilerFrog", KEY_READ);

		if (nError == ERROR_SUCCESS)
		{
			ULONG pnBytes = sizeof(DesktopSortConfig);
			
			if (key.QueryBinaryValue(L"LastDesktopSortData", this, &pnBytes) == ERROR_SUCCESS)
			{
				return true;
			}
		}

		return false;
	}

};

struct DesktopSortConfigBlueSky: public DesktopSortConfig
{
	DesktopSortConfigBlueSky()
	{
		bgGradientColor1 = Gdiplus::Color::Blue;
		bgGradientColor2  = Gdiplus::Color::SkyBlue;

		itemGradientColor1 = Gdiplus::Color::DarkBlue;
		itemGradientColor2 = Gdiplus::Color::DarkCyan;

		borderColor = Gdiplus::Color::BlueShift;
		groupBorderOpacity = 150;

		useExistingWallaper = false;
	}
};

struct DesktopSortConfigEggPlant: public DesktopSortConfig
{
	DesktopSortConfigEggPlant()
	{
		bgGradientColor1 = Gdiplus::Color::Indigo;
		bgGradientColor2  = Gdiplus::Color::DarkBlue;

		itemGradientColor1 = Gdiplus::Color::Tan;
		itemGradientColor2 = Gdiplus::Color::Goldenrod;
		groupBorderOpacity = 100;

		useExistingWallaper = false;
	}
};

struct DesktopSortConfigSunset: public DesktopSortConfig
{
	DesktopSortConfigSunset()
	{
		bgGradientColor1 = Gdiplus::Color::OrangeRed;
		bgGradientColor2  = Gdiplus::Color::DarkOrange;

		itemGradientColor1 = Gdiplus::Color::Moccasin;
		itemGradientColor2 = Gdiplus::Color::LightCoral;

		groupBorderOpacity = 100;

		useExistingWallaper = false;
	}
};

struct DesktopSortConfigDesktopDark: public DesktopSortConfig
{
	DesktopSortConfigDesktopDark()
	{
		bgGradientColor1 = Gdiplus::Color::Black;
		bgGradientColor2  = Gdiplus::Color::DarkGray;
						   
		itemGradientColor1 = Gdiplus::Color::Gray;
		itemGradientColor2 = Gdiplus::Color::DimGray;

		groupBorderOpacity = 100;

		useExistingWallaper = false;
	}
};


